#{extends 'main.html' /}
#{set title:'Register' /}

<div id="content" class="about-me">
#{if user.id}
<h3>Edit Profile</h3>
#{/if}
#{else}
<h3>Register</h3>
#{/else}
  <form action="@{Users.save()}" name="form" id="form" method="POST" enctype="multipart/form-data" style="width:630px;">
<input type="hidden" name="user.id" value="${user.id}" />

  <ul class="long_login">
    <li>
      <label>Full Name</label>
      <input type="text" name="user.fullname" value="${user.fullname}" />
      <span class="error">#{error 'user.fullname' /}</span>
    </li>
    <li>
      <label>Email</label>
      <input type="text" name="user.email" value="${user.email}" />
      <span class="error">#{error 'user.email' /}</span>
    </li>
    <li>
      <label>Password</label>
      <input type="password" name="user.password" value="${user.password}" />
      <span class="error">#{error 'user.password' /}</span>
    </li>
    <li>
      <label>City</label>
      <input type="text" name="user.address" value="${user.address}" />
      <span class="error">#{error 'user.address' /}</span>
    </li>
    <li>
      <label>Photo</label>
      <input type="file" name="user.photo" />
    </li>
  <input type="submit" class="login_button" name="submit" value="Submit" />
  </ul>
  </form>
  
  
  <!-- client side validations -->
  
  <script  language="javascript" type="text/javascript">
 var frmvalidator  = new Validator("form");
 frmvalidator.EnableMsgsTogether(); //display all messages together
                     //where myform is the name/id of your form
frmvalidator.addValidation("user.fullname","req","Please enter your Name");
  frmvalidator.addValidation("user.fullname","maxlen=40",	"Max length for Name is 40");
  //frmvalidator.addValidation("user.fullname","alpha","Alphabetic chars only for your name");
  
  frmvalidator.addValidation("user.address","req","Please enter your City");
  frmvalidator.addValidation("user.address","maxlen=40",	"Max length for Address is 40");

frmvalidator.addValidation("user.email","maxlen=60");
  frmvalidator.addValidation("user.email","req", "Please provide your e-mail address");
  frmvalidator.addValidation("user.email","email");

  frmvalidator.addValidation("user.password","req", "Please enter a password");
  frmvalidator.addValidation("user.password","minlen=5",	"Min length for password is 5");
  
  

</script>
</div>
